<!--<script src="__PUBLIC__/Theme/Admin/Dwz/js/jquery-1.4.4.min.js" type="text/javascript"></script>-->
<script type="text/javascript">
<!--
function selectApp_module(groupId, appId){
	var url = "__URL__/module/groupId/"+ groupId +"/appId/" + appId;
	$("#moduleSelectBox", $.pdialog.getCurrent()).loadUrl(url);
}

function selectApp_action(form$){
	var $form = $(form$, $.pdialog.getCurrent())
	var groupId = $form.find(":input[name=groupId]").val();
	var appId = $form.find(":input[name=appId]").val();
	var url = "__URL__/action/groupId/"+ groupId +"/appId/" + appId;
	$("#moduleSelectBox", $.pdialog.getCurrent()).loadUrl(url);
}
function selectModule_action(form$){
	var $form = $(form$, $.pdialog.getCurrent())
	var groupId = $form.find(":input[name=groupId]").val();
	var appId = $form.find(":input[name=appId]").val();
	var moduleId = $form.find(":input[name=moduleId]").val();
	var url = "__URL__/action/groupId/"+ groupId +"/appId/" + appId + "/moduleId/" + moduleId;
	$("#actionSelectBox", $.pdialog.getCurrent()).loadUrl(url);
}
function set_group_ck_hidden(name,v){
	var group_ck_ids=$("#group_ck_ids").val();
	var arrSon = document.getElementsByName(name);
	group_ck_ids="";
	
	for(var i=0; i<arrSon.length; i++) {
		 if(arrSon[i].checked) {
			if(group_ck_ids==""){
			  group_ck_ids=","+arrSon[i].value+",";
			}else{
			  group_ck_ids=group_ck_ids+arrSon[i].value+",";
			}
		 }
		 //将它所属的所有checkbox选中
		 if(arrSon[i].value==v){
		    model_ck_value="";
		    if(arrSon[i].checked){
			    set_secbox_checked(arrSon[i].value,true);
			}else{
				set_secbox_checked(arrSon[i].value,false);
			}
		 }
	 }
	$("#group_ck_ids").val(group_ck_ids);
}

function set_secbox_checked(v1,act){
var arrSec= document.getElementsByName("model_ck_"+v1+"[]");
var model_ck_value= new Array();
var arrth;
var v2;
				for(var p1=0;p1<arrSec.length;p1++){
				   arrSec[p1].checked=act;//////////////////////opt_ck_2[]/////////2_Node/////////////////////  
				   v2=arrSec[p1].value;
				   model_ck_value=v2.split("_"); 
				   arrth=document.getElementsByName("opt_ck_"+model_ck_value[0]+"[]");
				   for(var p2=0;p2<arrth.length;p2++){
				   		arrth[p2].checked=act;
				   }
				}

}

function set_child_checked(obj,v){
	var arrchild= document.getElementsByName("opt_ck_"+v+"[]");
	if(obj.checked){
	   for(var p1=0;p1<arrchild.length;p1++){
			arrchild[p1].checked=true;
	   }
	}else{
	   for(var p1=0;p1<arrchild.length;p1++){
			arrchild[p1].checked=false;
		}
	}	
}

function set_all_box(o,name){
	var inputs = document.getElementsByTagName("input");
	for(var i=0;i<inputs.length;i++){
	  var obj = inputs[i];
	  if(obj.type=='checkbox'){
	      if(o.checked){
		    obj.checked=true;
		  }else{
		     obj.checked=false;
			 $("#group_ck_ids").val("");
		  } 
	  }
	}
	 if(o.checked){
		    var arrSon = document.getElementsByName(name);
			group_ck_ids="";
			 for(var i=0; i<arrSon.length; i++) {
			 	if(group_ck_ids==""){
				  group_ck_ids=","+arrSon[i].value+",";
				}else{
				  group_ck_ids=group_ck_ids+arrSon[i].value+",";
				}
			 }
			$("#group_ck_ids").val(group_ck_ids);
	 }else{
			 $("#group_ck_ids").val("");
     } 
			
	
	
}




function check_submit(obj,type){
   return validateCallback(obj,type);
}


//-->
</script>
<div class="page">
	<div class="tabs">
		<div class="tabsHeader">
			<div class="tabsHeaderContent">
				<ul>
					<li class="selected"><span>分组的权限分配</span></li>
					<!--<li><a href="__URL__/module/groupId/{$Think.get.groupId}" class="j-ajax"><span>模块授权</span></a></li>
					<li><a href="__URL__/action/groupId/{$Think.get.groupId}" class="j-ajax"><span>操作授权</span></a></li>-->
				</ul>
			</div>
		</div>
		
		<div class="tabsContent" >
			<div>
				<form method="post" action="__URL__/setApp" class="pageForm required-validate" onsubmit="return  check_submit(this, dialogAjaxDone)">
					<input type="hidden" name="groupId" VALUE="{%$Think.get.groupId%}" />
					<input type="hidden" name="group_ck_ids" id="group_ck_ids" VALUE="{%$menu_group%}" />
					<div class="pageFormContent" layoutH="100">
					{%$tp%}
					</div>
				<!--	<table width="100%" align="left">
					  <tr><td colspan="2" style="font-size:14px; color:#FF3300; font-weight:bold;"><input type="checkbox" name="group_ck" />系统设置</td></tr>
					  <tr style="height:30px;">
					      <td style="border-bottom:1px dashed #CCCCCC"><input type="checkbox" name="model_ck" />模块1管理</td>
					      <td style="border-bottom:1px dashed #CCCCCC"><input type="checkbox" name="opt_ck" />添加,<input type="checkbox" name="opt_ck" />删除,<input type="checkbox" name="opt_ck" />修改,</td>
					  </tr>
					  <tr style="height:30px;">
					      <td style="border-bottom:1px dashed #CCCCCC"><input type="checkbox" name="model_ck" />模块2管理</td>
					      <td style="border-bottom:1px dashed #CCCCCC"><input type="checkbox" name="opt_ck" />添加,<input type="checkbox" name="opt_ck" />删除,<input type="checkbox" name="opt_ck" />修改,</td>
					  </tr>
					  <tr style="height:30px;">
					      <td><input type="checkbox" name="model_ck" />模块3管理</td>
					      <td><input type="checkbox" name="opt_ck" />添加,<input type="checkbox" name="opt_ck" />删除,<input type="checkbox" name="opt_ck" />修改,</td>
					  </tr>
					  <tr>
					      <td colspan="2" style="border-bottom:1px solid #CCCCCC">&nbsp;</td>
					  </tr>
					  
					  <tr><td colspan="2" style="font-size:14px; color:#FF3300; font-weight:bold;"><input type="checkbox" name="group_ck" />应用中心</td></tr>
					  <tr>
					      <td><input type="checkbox" name="model_ck" />模块1管理</td>
					      <td><input type="checkbox" name="opt_ck" />添加,<input type="checkbox" name="opt_ck" />删除,<input type="checkbox" name="opt_ck" />修改,</td>
					  </tr>
					</table>-->
					
					
					<!--<div class="pageFormContent" layoutH="100">
						<volist id="item" name="appList">
							<div class="unit">			
								<input <?php echo in_array($key, $groupAppList) ? "checked" : "" ?> type="checkbox" name="groupAppId[]" value="{$key}"/>{$item}
							</div>
						</volist>
					</div>-->
					<div class="formBar">
						<label style="float:left"><input type="checkbox" class="checkboxCtrl"   onclick="set_all_box(this,'group_ck')"/>全选/反选</label>
						<ul>
							<!--<li><div class="button"><div class="buttonContent"><button type="button" class="checkboxCtrl" group="groupAppId[]" selectType="invert">反选</button></div></div></li>-->
							<li><div class="buttonActive"><div class="buttonContent"><button type="submit">保存</button></div></div></li>
							<li><div class="button"><div class="buttonContent"><button type="button" class="close">取消</button></div></div></li>
						</ul>
					</div>
				</form>				
			</div>
			
			<div>
				<!-- <include file="module" /> -->
			</div>
			<div>
				<!-- <include file="action" /> -->
			</div>
		</div>
		<div class="tabsFooter">
			<div class="tabsFooterContent"></div>
		</div>
	</div>
</div>
